import Vue from 'vue'
import Router from 'vue-router'
import Login from '../page/login/login.vue'
import Home from '../page/home/home.vue'
import Recharge from '../page/recharge/recharge.vue'
import RechargeLog from '../page/recharge/recharge_log.vue'
import Market from '../page/market/market.vue'
import MarketLog from '../page/market/market_log.vue'
import Agency from '../page/agency/agency.vue'
import AgencyDetails from '../page/agency/agency_details.vue'
import Personal from '../page/personal/personal.vue'
Vue.use(Router);

export default new Router({
  mode:'history',
  scrollBehavior:()=>({
    y:0
  }),
  routes: [
    {
      path:'', // 地址为空时跳转login页面
      redirect:'/login' // redirect 重定向路由
    },
    {
      path: '/login',
      component: Login
    },
    {
      path: '/home',
      component: Home
    },
    {
      path:'/recharge',
      component:Recharge,
      children:[
        {
          path:'recharge_log',// 注意:子路由前面不需要 '/'
          component:RechargeLog
        }
      ]
    },
    {
      path:'/market',
      component:Market,
      children:[
        {
          path:'market_log',// 注意:子路由前面不需要 '/'
          component:MarketLog
        }
      ]
    },
    {
      path:'/agency',
      component:Agency,
      children:[
        {
          path:'agency_details',
          component:AgencyDetails
        }
      ]
    },
    {
      path:'/personal',
      component:Personal
    }

  ]
})
